package com.iona.dao;

import org.hibernate.Session;

import com.iona.utils.HibernateUtils;

public class BaseDAO {

	protected Session getSession() {
		Session currentSession = HibernateUtils.getSessionFactory()
				.getCurrentSession();
		if (currentSession == null) {
			currentSession = HibernateUtils.getSessionFactory().openSession();
		}
		if(!currentSession.getTransaction().isActive()){
			currentSession.getTransaction().begin();
		}
		return currentSession;
	}

}
